<?php
/**
 * @link https://ym2.cleverstone.top
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace common\handlers;

use Yii;
use yii\base\BaseObject;
use yii\web\Request;
use yii\web\Response;
use common\components\RbacManager;
use common\models\SettingService;
use yii\web\Session;
use yii\web\User;

/**
 * 事件处理程序基类
 * @author cleverstone
 * @property-read Request $request
 * @property-read Response $response
 * @property-read RbacManager $rbacManager
 * @property-read SettingService $setting
 * @property-read Session $session
 * @property-read User $user
 * @since ym2.0
 */
abstract class BaseHandler extends BaseObject
{
    /**
     * @return Request
     */
    public function getRequest()
    {
        return Yii::$app->getRequest();
    }

    /**
     * @return Response
     */
    public function getResponse()
    {
        return Yii::$app->getResponse();
    }

    /**
     * @return RbacManager
     */
    public function getRbacManager()
    {
        return Yii::$app->rbacManager;
    }

    /**
     * @return settingService
     */
    public function getSetting()
    {
        return Yii::$app->setting;
    }

    /**
     * @return User
     */
    public function getUser()
    {
        return Yii::$app->user;
    }

    /**
     * @return Session
     */
    public function getSession()
    {
        return Yii::$app->session;
    }
}